<template>
    <view class="page" :style="themeColor">
        <view class="flex align-stretch benben-position-layout flex search_flex_0" :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
            <view class='flex align-center justify-between flex-sub search_fd0_0'>
                <view class='flex align-center justify-center search_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
                    <text class='fu-iconfont2  search_fd0_0_c0_c0'>&#xE794;</text>
                </view>
                <view class='flex align-center flex-sub search_fd0_0_c1'>
                    <input class='flex-sub search_fd0_0_c1_c0' type="text" :focus='true' placeholder="请输入关键字" confirm-type="done" :maxlength="-1" placeholder-style="color:rgba(191, 191, 191, 1);font-size:28rpx" v-model="keyword" />
                </view>
                <view class='flex flex-wrap align-center justify-center search_fd0_0_c2' @tap.stop="addHistorySerchFunc()">
                    <image class='search_fd0_0_c2_c0' mode="aspectFit" :src='STATIC_URL+"75.png"'></image>
                </view>
            </view>

        </view>
        <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
        <!---搜索记录flex布局开始-->
        <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout search_flex_1">
            <view class='flex flex-wrap align-center search_fd1_0'>
                <image class='search_fd1_0_c0' mode="aspectFit" :src='STATIC_URL+"76.png"'></image>
                <text class='search_fd1_0_c1'>历史搜索</text>
                <image class='search_fd1_0_c2' :src='STATIC_URL+"77.png"' @tap.stop="popupShow1686626950170=true"></image>
            </view>
            <view class='flex flex-wrap align-center search_fd1_1'>
                <template v-for='(item,key0) in appSearchHistory'>
                    <view class='flex flex-wrap align-center search_fd1_1_c0' :key='key0'>
                        <text class='search_fd1_1_c0_c0' @tap.stop="addHistorySerchFunc()">{{item.name}}</text>
                        <image class='search_fd1_1_c0_c1' :src='STATIC_URL+"78.png"' @tap.stop="clearHistoryFunc(item.name)"></image>
                    </view>
                </template>

            </view>
            <text class='search_fd1_2'>暂无历史搜索</text>
            <view class='flex flex-wrap align-center search_fd1_3'>
                <image class='search_fd1_0_c0' mode="aspectFit" :src='STATIC_URL+"79.png"'></image>
                <text class='search_fd1_3_c1'>搜索发现</text>
                <text class='search_fd1_3_c2'>换一批</text>
            </view>
            <view class='flex flex-wrap align-center search_fd1_1'>
                <view class='flex flex-wrap align-center search_fd1_4_c0'>
                    <text class='search_fd1_4_c0_c0'>收纳盒</text>
                    <image class='search_fd1_4_c0_c1' mode="aspectFit" :src='STATIC_URL+"80.png"'></image>
                </view>
                <view class='flex flex-wrap align-center search_fd1_1_c0'>
                    <text class='search_fd1_4_c1_c0'>面包</text>
                </view>
            </view>
        </view>

        <!---搜索记录flex布局结束-->
        <benben-popup v-model="popupShow1686626950170" :mask="true" mode='center'>
            <!---确认删除flex布局开始-->
            <view class="flex benben-flex-layout flex-wrap align-center">
                <view class='flex flex-direction flex-wrap align-center search_fd2_0'>
                    <text class='search_fd2_0_c0'> </text>
                    <text class='search_fd2_0_c1'>确定删除历史记录吗？</text>
                    <view class='flex flex-wrap align-center search_fd2_0_c2'>
                        <button class='search_fd2_0_c2_c0' @tap.stop="popupShow1686626950170=false">取消</button>
                        <button class='search_fd2_0_c2_c1' @tap.stop="clearHistoryFunc('')">确认</button>
                    </view>
                </view>
            </view>

            <!---确认删除flex布局结束-->

        </benben-popup>


    </view>
</template>
<script>
    export default {
        components: {},


        data() {
            return {
                "popupShow1686626950170": false,
                "keyword": ""
            };
        },
        computed: {
            themeColor() {
                return this.$store.getters.themeColor
            },
            appSearchHistory() { // 搜索历史
                return this.$store.state.appSearchHistory
            }
        },
        watch: {},
        onLoad(options) {

        },
        onUnload() {

        },
        onReady() {

        },
        onShow() {

        },
        onHide() {

        },
        onResize() {

        },
        onPullDownRefresh() {

        },
        onReachBottom(e) {

        },
        onPageScroll(e) {

        },
        methods: {
            //拨打电话
            callFunc(phone) {
                this.callMobile(phone);
                this.popupShow1686622666195 = false;
            },
            //添加历史记录
            addHistorySerchFunc() {
                this.$store.commit('appSearchHistoryAdd', {
                    "name": this.keyword
                })
                this.$urouter.navigateTo(`/pages/index/searchResult/searchResult?keyword=${this.keyword}`);
            },
            //清除历史记录
            clearHistoryFunc(type) {
                if (type != '') {
                    this.$store.commit('appSearchHistoryDel', {
                        "name": type
                    })
                } else {
                    this.$store.commit('appSearchHistoryClean', '')
                    this.popupShow1686626950170 = false;
                }
            }
        }
    };
</script>
<style lang="scss" scoped>
    .page {
        width: 100vw;
        overflow-x: hidden;
        min-height: calc(100vh - var(--window-bottom));
        background: var(--benbenbgColor1);
        background-size: 100% auto !important;
    }

    .search_flex_0 {
        background: #fff;
        width: 100%;
        height: 88rpx;
        overflow: hidden;
        z-index: 10;
        top: 0rpx;
        background-size: 100% auto !important;
    }

    .search_fd0_0_c2_c0 {
        width: 36rpx;
        height: 36rpx;
    }

    .search_fd0_0_c2 {
        margin: 0rpx 0rpx 0rpx 24rpx;
        width: 50rpx;
        height: 50rpx;
    }

    .search_fd0_0_c1_c0 {
        font-size: 28rpx;
        font-weight: 400;
        color: #333;
    }

    .search_fd0_0_c1 {
        background: #F9F9F9;
        height: 64rpx;
        border-radius: 34rpx 34rpx 34rpx 34rpx;
        padding: 0rpx 24rpx 0rpx 24rpx;
        margin: 0rpx 0rpx 0rpx 24rpx;
    }

    .search_fd0_0_c0_c0 {
        font-size: 32rpx;
        color: #333;
        line-height: 28rpx;
    }

    .search_fd0_0_c0 {
        width: 50rpx;
        height: 50rpx;
    }

    .search_fd0_0 {
        padding: 0rpx 32rpx 0rpx 32rpx;
        line-height: 88rpx;
    }

    .search_flex_1 {
        padding: 0rpx 0rpx 0rpx 0rpx;
    }

    .search_fd1_4_c1_c0 {
        font-size: 24rpx;
        font-weight: 400;
        color: rgba(51, 51, 51, 1);
    }

    .search_fd1_4_c0_c1 {
        width: 18rpx;
        height: 32rpx;
        border-radius: 0rpx 0rpx 0rpx 0rpx;
        position: absolute;
        top: -8rpx;
        right: 4rpx;
    }

    .search_fd1_4_c0_c0 {
        font-size: 24rpx;
        font-weight: 400;
        color: rgba(11, 11, 11, 1);
    }

    .search_fd1_4_c0 {
        border: 1px solid rgba(251, 34, 44, 1);
        background: #fff;
        border-radius: 32rpx 32rpx 32rpx 32rpx;
        background-size: 100% auto !important;
        padding: 0rpx 40rpx 0rpx 40rpx;
        line-height: 56rpx;
        margin: 0rpx 12rpx 24rpx 12rpx;
        position: relative;
    }

    .search_fd1_3_c2 {
        border: 1px solid #BFBFBF;
        margin: 0rpx 0rpx 0rpx auto;
        padding: 8rpx 16rpx 8rpx 16rpx;
        border-radius: 8rpx 8rpx 8rpx 8rpx;
    }

    .search_fd1_3_c1 {
        font-size: 32rpx;
        font-weight: 700;
        color: rgba(51, 51, 51, 1);
    }

    .search_fd1_3 {
        padding: 32rpx 0rpx 15rpx 0rpx;
        margin: 0rpx 24rpx 0rpx 24rpx;
    }

    .search_fd1_2 {
        font-size: 24rpx;
        font-weight: 400;
        color: #666666;
        margin: 0rpx 0rpx 32rpx 24rpx;
        line-height: 34rpx;
    }

    .search_fd1_1_c0_c1 {
        width: 18rpx;
        height: 18rpx;
        border-radius: 0rpx 0rpx 0rpx 0rpx;
    }

    .search_fd1_1_c0_c0 {
        font-size: 24rpx;
        font-weight: 400;
        color: rgba(51, 51, 51, 1);
        margin: 0rpx 16rpx 0rpx 0rpx;
    }

    .search_fd1_1_c0 {
        background: rgba(248, 248, 248, 1);
        border-radius: 32rpx 32rpx 32rpx 32rpx;
        background-size: 100% auto !important;
        padding: 0rpx 40rpx 0rpx 40rpx;
        line-height: 56rpx;
        margin: 0rpx 12rpx 24rpx 12rpx;
    }

    .search_fd1_1 {
        padding: 0rpx 0rpx 0rpx 12rpx;
    }

    .search_fd1_0_c2 {
        width: 24rpx;
        height: 28rpx;
        border-radius: 0rpx 0rpx 0rpx 0rpx;
        margin: 0rpx 0rpx 0rpx auto;
    }

    .search_fd1_0_c1 {
        font-size: 32rpx;
        font-weight: 500;
        color: rgba(51, 51, 51, 1);
    }

    .search_fd1_0_c0 {
        width: 34rpx;
        height: 34rpx;
        border-radius: 17rpx 17rpx 17rpx 17rpx;
        margin: 0rpx 16rpx 0rpx 0rpx;
    }

    .search_fd1_0 {
        padding: 32rpx 0rpx 24rpx 0rpx;
        margin: 0rpx 24rpx 0rpx 24rpx;
    }

    .search_fd2_0_c2_c1 {
        background: transparent;
        font-size: 32rpx;
        color: rgba(205, 150, 45, 1);
        width: 270rpx;
        height: 101rpx;
        line-height: 101rpx;
        font-weight: 500;
        border-radius: 0rpx 0rpx 32rpx 0rpx;
    }

    .search_fd2_0_c2_c0 {
        border-right: 1px solid #eee;
        background: #fff;
        font-size: 32rpx;
        color: rgba(153, 153, 153, 1);
        width: 270rpx;
        height: 101rpx;
        line-height: 101rpx;
        font-weight: 400;
        border-radius: 0rpx 0rpx 0rpx 32rpx;
    }

    .search_fd2_0_c2 {
        border-top: 1px solid #eee;
        margin: 51rpx 0rpx 0rpx 0rpx;
        border-radius: 0rpx 0rpx 32rpx 32rpx;
    }

    .search_fd2_0_c1 {
        line-height: 44rpx;
        font-size: 28rpx;
        font-weight: 500;
        color: #333333;
        text-align: center;
        margin: 32rpx 40rpx 0rpx 40rpx;
    }

    .search_fd2_0_c0 {
        line-height: 44rpx;
        font-size: 36rpx;
        font-weight: 700;
        color: #333333;
        margin: 40rpx 0rpx 0rpx 0rpx;
    }

    .search_fd2_0 {
        background: #fff;
        width: 540rpx;
        background-size: 100% auto !important;
        border-radius: 32rpx 32rpx 32rpx 32rpx;
    }
</style>